From b208af522858cb0983533d678a7c99c05e07bbfb Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 10 Dec 2013 14:13:53 -0800 Subject: [PATCH] Add "nocreate" and "createonly" options to edit.php Change-Id: I2101360a934b8b9a92094c44429e3e2314c7fba3 --- maintenance/edit.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/maintenance/edit.php b/maintenance/edit.php index 6e696513b8..6bdb15d90b 100644 --- a/maintenance/edit.php +++ b/maintenance/edit.php @@ -38,6 +38,8 @@ class EditCLI extends Maintenance { $this->addOption( 'bot', 'Bot edit', false, false, 'b' ); $this->addOption( 'autosummary', 'Enable autosummary', false, false, 'a' ); $this->addOption( 'no-rc', 'Do not show the change in recent changes', false, false, 'r' ); + $this->addOption( 'nocreate', 'Don\'t create new pages', false, false ); + $this->addOption( 'createonly', 'Only create new pages', false, false ); $this->addArg( 'title', 'Title of article to edit' ); } @@ -67,6 +69,12 @@ class EditCLI extends Maintenance { } $context->setTitle( $title ); + if ( $this->hasOption( 'nocreate' ) && !$title->exists() ) { + $this->error( "Page does not exist", true ); + } elseif ( $this->hasOption( 'createonly' ) && $title->exists() ) { + $this->error( "Page already exists", true ); + } + $page = WikiPage::factory( $title ); # Read the text -- 2.20.1